#include <QSettings>

#include <lgpl-components/cobjectmanager.h>
#include <messaginglayer/cmessaginglayer.h>

#include "actionmanager.h"
#include "contextmanager.h"
#include "icore.h"
#include "mainwindow.h"
#include "uidmanager.h"

ICore * ICore::m_instance = 0;

ICore::ICore(MainWindow *parent) :
    QObject(parent),
    m_mainWindow(parent),

    m_settings(new QSettings(QSettings::IniFormat, QSettings::UserScope, "sii-storm", "sii-storm", this)),
    m_objectManager(new CObjectManager(this)),
    m_messagingLayer(new CMessagingLayer(this)),
    m_uidManager(new UidManager(this)),
    m_contextManager(new ContextManager(this)),
    m_actionManager(new ActionManager(this))
{
    if (m_instance)
        qDebug("Icore already have instance");

    m_instance = this;
}

ICore::~ICore()
{
    m_instance = 0;
}

ICore * ICore::instance()
{
    return m_instance;
}


QSettings * ICore::settings() const
{
    return m_settings;
}

MainWindow * ICore::mainWindow() const
{
    return m_mainWindow;
}

CObjectManager * ICore::objectManager() const
{
    return m_objectManager;
}

CMessagingLayer * ICore::messagingLayer() const
{
    return m_messagingLayer;
}

UidManager * ICore::uidManager() const
{
    return m_uidManager;
}

ContextManager * ICore::contextManager() const
{
    return m_contextManager;
}

ActionManager * ICore::actionManager() const
{
    return m_actionManager;
}
